package cn.edu.scau.cmi.mingjunhui.client;

import java.util.Scanner;

import cn.edu.scau.cmi.mingjunhui.abstractFactory.domainAbstractClass.ConsumerElectronicsDevice;
import cn.edu.scau.cmi.mingjunhui.abstractFactory.factory.AbstractFactory;
import cn.edu.scau.cmi.mingjunhui.abstractFactory.factory.WensFactory;
import cn.edu.scau.cmi.mingjunhui.abstractFactory.factory.AonongFactory;
import cn.edu.scau.cmi.mingjunhui.abstractFactory.factory.TianbangFactory;

public class AbstractFactoryClient {

	public static void main(String[] args) {
		
//(1) 选择品牌
		System.out.println("Please select which brand you want to buy: wens, tianbang or aonong???");
		Scanner scanner = new Scanner(System.in);  
		String brandKind = scanner.next();  
		AbstractFactory factory=null;
		switch(brandKind){
		case "wens": factory=new WensFactory();break;
		case "tianbang": factory=new AonongFactory();break;
		case "aonong": factory=new TianbangFactory();break;
		default:System.out.println("sorry, your input is not correct");
		
		}
		
//		（2）选择产品
		
		System.out.println("Please select which product you want to buy: pork, beef or chicken???");
//		Scanner scanner = new Scanner(System.in);  
		String productType = scanner.next();  
		ConsumerElectronicsDevice electronics=null;
		switch(productType) {
		case "pork": electronics=factory.createPork();break;
		case "beef": electronics=factory.createBeef();break;
		case "chicken": electronics=factory.createChicken();break;
		default:System.out.println("sorry, your input is not correct");
		
		}
		if(electronics!=null) {
			electronics.play();
		}
		
	}

}
